package com.thinklib.mapper;

import com.thinklib.bean.Book;
import com.thinklib.bean.ExtCode;
import org.apache.ibatis.annotations.*;

public interface FileUploadMapper {

        // 添加PDF电子书
        @Insert("INSERT INTO t_book(book_name,cip,isbn,publisher,author,avatar,category,language,file_size,version,remark) values(#{bookName},#{cip},#{isbn},#{publisher},#{author},#{avatar},#{category},#{language},#{fileSize},#{version},#{remark})")
        // 获取数据库自增ID，keyProperty：java对象的属性，keyColumn：数据库字段名称
        @Options(useGeneratedKeys=true,keyProperty="bookId",keyColumn="book_id")
        int addFile(Book book);

        // 添加PDF电子书
        @Insert("INSERT INTO t_ext_code(book_id,alibaba_ext_code,baidu_ext_code) values(#{bookId},#{alibabaExtCode},#{baiduExtCode})")
        // 获取数据库自增ID，keyProperty：java对象的属性，keyColumn：数据库字段名称
        int addExtCode(ExtCode extCode);

}
